<template>
	<div class="store" id="store">
		<div class="word_main">
			<div class="st_t1">
				商家查询
			</div>
			<div class="word_title">
				<div class="word_title_list">
					<div class="word_name">商家:</div>
					<select v-model="wordlist.brandId">
						<option value="0">所有商家</option>
						<option v-for="item in selectlist" v-bind:value="item.id">{{item.brandName}}</option>
					</select>
				</div>
				<div class="word_title_list">
					<div class="word_name">创建时间:</div>
					<div class="word_time">
						<input type="text" placeholder="开始时间" onclick="laydate()" v-model="wordlist.createTimeStart" />
						<span>--</span>
						<input type="text" placeholder="结束时间" onclick="laydate()" v-model="wordlist.createEnd" />
					</div>
				</div>
				<div class="word_title_list">
					<button v-on:click="search()">搜索</button>
				</div>
				<div class="word_title_list">
					<button v-on:click="addstore()">新增商家</button>
				</div>
			</div>
		</div>
		<div class="word_table_list">
			<div class="st_t1">
				商家列表：
			</div>
			<companytable ref="wxref"></companytable>
			<div id="paging1" class="page"></div>
		</div>
	</div>
</template>

<script>
	import companytable from "./pannel/company_table"
	export default {
		name: 'store',
		computed: {},
		data() {
			return {
				title: '',
				selectlist:[],
				wordlist:{
					brandId:'0',
					createTimeStart:'',
					createEnd:'',
				}
			}
		}, //定义变量
		components: {
			companytable
		}, //注册组件
		methods: { //方法都在这里
			addstore:function(){
				var that=this;
				that.$router.push({
					path: '/user/addstore'
				})
			},
			search:function(){
				var that=this
				this.lh_http('post', "tbWords/tbWordsJsonList.do",this.wordlist).done(function(res) {
				if(res.status) {
					that.$refs.wxref.storelist=res.data.tbWordsList
				} else {
					alert(res.data);
				}
			})
			}
		},
		mounted() {
			var that = this;
			//获取banner
		},
		beforeCreate:function(){
			var storeId={
				brandId:0
			}
			var that = this;
			this.lh_http('post', "tbBrand/tbBrandJsonList",storeId).done(function(res) {
				if(res.status) {
//					console.log(res)
					that.selectlist=res.data.tbBrandList.resultList
				} else {
					alert(res.data);
				}
			})
		}
	}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss">
	.store {
		text-align: left;
		.st_t1 {
			line-height: 40px;
			font-size:24px;
			font-weight: normal;
			background:#ECECEC;
			padding-left:20px;
		}
		.word_title{
			width:100%;
			height:50px;
			margin-top:20px;
			.word_title_list{
				width:25%;
				height:50px;
				float: left;
				.word_name{
					float: left;
					line-height: 50px;
					padding-left:20px;
				}
				select{
					height:30px !important;
					margin-top:10px !important;
					margin-left:20px;
				}
				.word_time{
					overflow: hidden;
					zoom: 1;
					padding-left:20px;
					input{
						float:left;
						width:100px;
						height:30px;
						margin-top:10px;
						border:#ECECEC solid 1px;
						padding-left:5px;
					}
					span{
						float:left;
						line-height: 50px;
					}
				}
				.key_word{
					float: left;
					padding-left:20px;
					input{
						border:#ECECEC solid 1px;
						width:110px;
						height:30px;
						margin-top:10px;
					}
				}
				button{
					width:100%;
					height:40px;
					border-radius:4px;
					margin-top:5px;
					font-size:16px;
				}
			}
			.word_title_list:nth-child(2){
				width:34%;
			}
			.word_title_list:last-child{
				width:15%;
				button{
					background:#007AFF;
					color:#fff;
				}
			}
			.word_title_list:nth-child(3){
				width: 15%;
				margin-right:5%;
			}
		}
		.add_aompany{
			text-align: right;
			margin-top:40px;
			button{
				width:140px;
				height:40px;
				background:#007AFF;
				color:#fff;
				cursor: pointer;
				outline: none;
				border:0;
				border-radius:4px;
			}
		}
		.word_table_list{
			margin-top:100px;
		}
	}
	
</style>